<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="java.util.*"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
//response.sendRedirect("common/login");
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Stu</title>
			<script type="text/javascript" src="${path }/resource/js/jquery-1.8.3.min.js"></script>
			<script type="text/javascript" src="${path }/resource/js/mytools.js"></script>
			<script type="text/javascript" src="${path }/resource/layui/layui.js" ></script>
			<link rel="stylesheet" href="${path }/resource/layui/css/layui.css" />
	</head>
	<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>学生信息</legend>
</fieldset>
 
<form class="layui-form" action="" id="from1">
<div class="layui-form-item">
<div class="layui-inline">
      <label class="layui-form-label">姓名</label>
      <div class="layui-input-inline">
        <input type="text" name="name" value="${obj.name}" id="name" placeholder="姓名" autocomplete="off" class="layui-input" >
      </div>
    </div>
</div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <input  type="button" value="保存"  class="layui-btn"  lay-submit="" lay-filter="form1" >
      <input type="reset" class="layui-btn layui-btn-primary" value="重置">
    </div>
  </div>
</form>
	<script type="text/javascript">
		layui.use(['form', 'layedit', 'laydate'], function(){
			  var form = layui.form()
			  ,layer = layui.layer
			  ,layedit = layui.layedit
			  ,laydate = layui.laydate;
			  //监听提交
			  form.on('submit(form1)', function(data){
				  mytooljs.initForm({
						sendurl:"${path }/user/test/Stu/addOrModify",//发送请求的地址
						data:data.field,//传数据过去
						afterload:function(){//请求成功后回调
							 layer.open({
						       	  content: '保存成功'
						       	  ,btn: ['确定']
						       	  ,yes: function(index, layero){
						       		parent.mjs.search();
						       		parent.layer.closeAll();
						       	  }
						       	}); 
						}
					});
			   /*  layer.alert(JSON.stringify(data.field), {
			      title: '最终的提交信息'
			    }) */
			    return false;
			  });
			});
		</script>
	</body>
</html>
